import tkinter as tk
from atestresultvalue import ATestResultValue

res = 'result_value'
complete_dict = {'ATestResultValue':ATestResultValue,
                 'ATestResultValue.temp_str':lambda :setattr(ATestResultValue,'temp_str',res)
                 }

def btn_run_event():
    key = entry.get()
    complete_dict[key]()
    print(complete_dict)
    print(ATestResultValue, ATestResultValue.temp_str, id(ATestResultValue.temp_str))
    print('程序逻辑已运行')

def btn_get_event():
    print(ATestResultValue.temp_str)
    print('获取全局变量值')

root = tk.Tk()
root.geometry('300x300')
entry = tk.Entry(root)
entry.pack()

btn_run = tk.Button(root, text='运行逻辑,内部赋值',command=btn_run_event)
btn_run.pack()


btn_get_value = tk.Button(root, text='获取值', command=btn_get_event)
btn_get_value.pack(side='bottom')

root.mainloop()
